<template>
  <div>
    <h1>当前的和为{{$store.state.num}}</h1>
    <select v-model.number="count">
        <option value="0">0</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
    </select>
    <button @click="add">+</button>
    <button @click="sub">-</button>
    <button @click="waitadd">等待加</button>
  </div>
</template>

<script>
export default {
name: 'countTest',
data(){
    return{
        count: 0
    }
},
methods: {
    add() {
        this.$store.commit('JIA', this.count)
    },
    sub() {
        this.$store.commit('SUB', this.count)
    },
    waitadd() {
        this.$store.dispatch('WaitAdd', this.count)
    }
}
}
</script>

<style>

</style>